#include<iostream>

using namespace std;

int main()
{

	int x, y;

	cin >> x >> y;

	int chicken = 0, ribbit = 0;

	for (int i = 0; i < x; i++)
	{

		chicken = i;

		ribbit = x - i;

		if (chicken * 2 + ribbit * 4 == y)
		{
			break;
		}
	}

	cout << chicken << " " << ribbit;

	return 0;
}